import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  
   {
    title: '部门',
    align:"center",
    dataIndex: 'departmentId_dictText'
   },
   {
    title: '新规则名称',
    align:"center",
    dataIndex: 'attRuleName'
   },
   {
    title: '旧规则名称',
    align:"center",
    dataIndex: 'oldAttRuleName'
   },
   {
    title: '变更类型',
    align:"center",
    dataIndex: 'changeType',
    sorter: {
            multiple: 3,
          },
    filters: [
        { text: '修改', value: 'u' },
        { text: '删除', value: 'd' },
    ],
    customRender: ({ record }) => {
      return record.changeType ? (record.changeType == 'n' ? '新增' :record.changeType == 'u'? '修改':'删除') : '';
    },
   },
   {
    title: '创建人',
    align:"center",
    dataIndex: 'createBy'
   },
   {
    title: '创建日期',
    align:"center",
    sorter: true,
    dataIndex: 'createTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "部门",
      field: 'departmentId',
      component: 'JSelectDept',
      //colProps: {span: 6},
 	},
	{
      label: "新规则名称",
      field: 'attRuleName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "旧规则名称",
      field: 'oldAttRuleName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "变更类型",
      field: 'changeType',
      component: 'JDictSelectTag',
      componentProps: {
        options: [
         
          { label: '修改', value: 'u' },
          { label: '删除', value: 'd' },
        ],
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '部门',
    field: 'departmentId',
     component: 'JSelectDept',
  },
  {
    label: '新规则名称',
    field: 'attRuleName',
    component: 'Input',
  },
  {
    label: '旧规则名称',
    field: 'oldAttRuleName',
    component: 'Input',
  },
  {
    label: '变更类型',
    field: 'changeType',
    component: 'JDictSelectTag',
    componentProps:{
       options: [
        
         { label: '修改', value: 'u' },
         { label: '删除', value: 'd' },
       ],
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  createBy: {title: '创建人',order: 0,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 1,view: 'datetime', type: 'string',},
  departmentId: {title: '部门',order: 2,view: 'sel_depart', type: 'string',},
  attRuleName: {title: '新规则名称',order: 3,view: 'text', type: 'string',},
  oldAttRuleName: {title: '旧规则名称',order: 4,view: 'text', type: 'string',},
  changeType: {title: '变更类型',order: 5,view: 'list', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
